package hu;

import java.util.*;

public class hu90 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        String[] ip = input.split("\\.");
        if(ip.length != 4){
            System.out.println("NO");
            return;
        }
        for (int i = 0; i < ip.length; i++) {
            if(ip[i].equals("")){
                System.out.println("NO");
                return;
            }
            int n = Integer.parseInt(ip[i]);
            if((ip[i].length() > 1 && n < 10) || n > 255){
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
}
